<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>道路事件检测模型</title>
    <style>
        body {
            font-family: 'Arial', sans-serif;
            max-width: 1000px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f5f5f5;
            color: #333;
        }
        .container {
            background-color: white;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
        }
        .upload-area {
            border: 2px dashed #ccc;
            border-radius: 8px;
            padding: 30px;
            text-align: center;
            margin-bottom: 20px;
            cursor: pointer;
            transition: border-color 0.3s;
        }
        .upload-area:hover {
            border-color: #3498db;
        }
        .upload-area.dragover {
            border-color: #3498db;
            background-color: #f0f8ff;
        }
        #file-input {
            display: none;
        }
        .preview-container {
            margin-top: 20px;
            text-align: center;
            position: relative;
        }
        #image-preview {
            max-width: 100%;
            max-height: 400px;
            display: none;
            margin: 0 auto;
            border-radius: 5px;
            border: 1px solid #ddd;
        }
        .btn {
            background-color: #3498db;
            color: white;
            padding: 12px 24px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            margin-top: 15px;
            transition: background-color 0.3s;
        }
        .btn:hover:not(:disabled) {
            background-color: #2980b9;
        }
        .btn:disabled {
            background-color: #cccccc;
            cursor: not-allowed;
        }
        .results-container {
            margin-top: 30px;
            padding: 20px;
            background-color: #f9f9f9;
            border-radius: 5px;
            display: none;
        }
        .no-events {
            text-align: center;
            padding: 20px;
            color: #27ae60;
            font-weight: bold;
        }
        .event-card {
            background-color: white;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            border-left: 5px solid #e74c3c;
        }
        .event-card.medium-risk {
            border-left-color: #f39c12;
        }
        .event-card.low-risk {
            border-left-color: #27ae60;
        }
        .event-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
        }
        .event-type {
            font-size: 18px;
            font-weight: bold;
            color: #2c3e50;
        }
        .event-level {
            padding: 4px 12px;
            border-radius: 20px;
            font-weight: bold;
            font-size: 14px;
        }
        .high-risk {
            background-color: #ffebee;
            color: #e74c3c;
        }
        .medium-risk {
            background-color: #fff3e0;
            color: #f39c12;
        }
        .low-risk {
            background-color: #e8f5e9;
            color: #27ae60;
        }
        .event-details {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }
        .detail-item {
            display: flex;
            flex-direction: column;
        }
        .detail-label {
            font-size: 12px;
            color: #7f8c8d;
            margin-bottom: 4px;
        }
        .detail-value {
            font-size: 14px;
            font-weight: 500;
        }
        .confidence-bar {
            height: 20px;
            background-color: #f0f0f0;
            border-radius: 10px;
            margin-top: 5px;
            overflow: hidden;
            position: relative;
        }
        .confidence-fill {
            height: 100%;
            background-color: #3498db;
            border-radius: 10px;
            transition: width 0.5s ease-in-out;
        }
        .confidence-text {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            text-align: center;
            color: white;
            font-weight: bold;
            font-size: 12px;
            line-height: 20px;
        }
        .event-description {
            background-color: #f8f9fa;
            padding: 15px;
            border-radius: 5px;
            margin-top: 15px;
            border-left: 3px solid #3498db;
        }
        .loading {
            text-align: center;
            margin: 20px 0;
            display: none;
        }
        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #3498db;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            animation: spin 1s linear infinite;
            margin: 0 auto;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        .detection-overview {
            background-color: #e3f2fd;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
            text-align: center;
            font-weight: bold;
        }
        .detected {
            color: #e74c3c;
        }
        .not-detected {
            color: #27ae60;
        }
        .video-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            margin: 20px;
            }
            video {
            border: 1px solid #ccc;
            border-radius: 8px;
            background-color: #000;
            }
    </style>
</head>
<body>
    <div class="container">
        <h1>道路事件检测模型</h1>
        
        <div class="upload-area" id="upload-area">
            <p>点击或拖拽图片到这里上传</p>
            <input type="file" id="file-input" accept="image/*">
        </div>
        
        <div class="preview-container">
            <img id="image-preview" alt="图片预览">
        </div>
        
        <div style="text-align: center;">
            <button class="btn" id="process-btn" disabled>开始事件检测</button>
        </div>
        
        <div class="loading" id="loading">
            <div class="spinner"></div>
            <p>模型分析中，请稍候...</p>
        </div>
        
        <div class="results-container" id="results-container">
            <h2>检测结果</h2>
            <div id="detection-overview" class="detection-overview"></div>
            <div id="events-list"></div>
        </div>

        <div class="video-container">
            <h3>施工视频回放</h3>
            <video width="800" height="450" controls>
                <source src="http://223.109.220.187:9000/construction-evidence-dev/2025-10-17/videos/1977995792945909760/1760666800_detection.mp4" type="video/mp4">
            </video>    
        </div>
</body>
</html>